# 创建三千个文件
# 文件名称格式： 序号_物资类别_用户识别码
import random
import os
def createname () :
    lst = ['酒水','水果','烟酒','糖油','肉蛋','蔬菜']
    lst2 = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']
    naemList = []
    for item in range(0,3000) :
        sub = ''
        name = random.choice(lst)

        if len(str(item)) < 4 :
            item = '0'*(4-len(str(item))) +str(item)

        for j in range(0,10) :
            sub +=random.choice(lst2)
        filename = str(item)+'_'+name+'_'+sub
        naemList.append(filename)
        # with open('now2.txt', 'r+', encoding="utf-8") as file:
    return naemList

def createfile () :
    names = createname()
    if os.path.exists('./ab') :
        for name in names :
            with open('./ab/'+name+'.txt', 'w', encoding="utf-8") as file :
                pass
    else :
        print('目标文件夹不存在')
if __name__ == '__main__':
    createfile()

    os.removedirs('./ab/**')